/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package practtica4;

import BBDD.GestorBBDD;
import DTO.Acontecimiento;

/**
 *
 * @author Usuario
 */
public class V1BSimpleMuestraAcon extends javax.swing.JFrame {

    /**
     * Creates new form V1BSimpleMuestraAcon
     */
    GestorBBDD gestor=new GestorBBDD();
    private Acontecimiento acont;
    public V1BSimpleMuestraAcon(Acontecimiento acont) {
        this.acont=acont;
        initComponents();
        cargarrEtiquetas();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Volver = new javax.swing.JButton();
        labelFechaFin = new javax.swing.JLabel();
        labelId = new javax.swing.JLabel();
        labelDesc = new javax.swing.JLabel();
        labelFechaIni = new javax.swing.JLabel();
        labelNombre = new javax.swing.JLabel();
        botonId = new javax.swing.JTextField();
        botonNombre = new javax.swing.JTextField();
        botonDescr2 = new javax.swing.JTextField();
        botonFechaIni = new javax.swing.JTextField();
        botonFechaFin = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        botonfich = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        Volver.setText("Volver");
        Volver.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                VolverMouseClicked(evt);
            }
        });

        labelFechaFin.setText("Fecha fin");

        labelId.setText("id");

        labelDesc.setText("descripción");

        labelFechaIni.setText("Fecha inicio");

        labelNombre.setText("nombre");

        botonNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonNombreActionPerformed(evt);
            }
        });

        botonFechaFin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonFechaFinActionPerformed(evt);
            }
        });

        jLabel1.setText("Ficheros");

        botonfich.setColumns(20);
        botonfich.setRows(5);
        jScrollPane1.setViewportView(botonfich);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(botonDescr2)
                    .addComponent(botonId, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(botonNombre, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(botonFechaIni)
                    .addComponent(botonFechaFin, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
                .addGap(77, 77, 77))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(157, 157, 157)
                        .addComponent(Volver)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(90, 90, 90)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(91, 91, 91)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(labelId)
                        .addComponent(labelFechaFin)
                        .addComponent(labelFechaIni)
                        .addComponent(labelDesc)
                        .addComponent(labelNombre))
                    .addContainerGap(254, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(botonId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(botonNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(botonDescr2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addComponent(botonFechaIni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(botonFechaFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(Volver))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 91, Short.MAX_VALUE))))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(39, 39, 39)
                    .addComponent(labelId)
                    .addGap(36, 36, 36)
                    .addComponent(labelNombre)
                    .addGap(36, 36, 36)
                    .addComponent(labelDesc)
                    .addGap(40, 40, 40)
                    .addComponent(labelFechaIni)
                    .addGap(39, 39, 39)
                    .addComponent(labelFechaFin)
                    .addContainerGap(210, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
 private void cargarrEtiquetas() {
        String id=acont.getId()+"";
       this.botonId.setText(id);
       this.botonNombre.setText(acont.getNombre());
       this.botonDescr2.setText(acont.getDescripcion());
       this.botonFechaIni.setText(acont.getFechaIni().toString());
       this.botonFechaFin.setText(acont.getFechaFin().toString());
       this.botonId.setEditable(false);
       this.botonNombre.setEditable(false);
       this.botonDescr2.setEditable(false);
       this.botonFechaIni.setEditable(false);
       this.botonFechaFin.setEditable(false);
       String fich="";
        int i=0;
        while(i<acont.getFich().size()){
            fich+= acont.getFich().get(i).getNombre()+'\n';
            i++;
        }
        this.botonfich.setText(fich);
        this.botonfich.setEditable(false);
    }
 
    private void VolverMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_VolverMouseClicked
        V1 v1= new V1();
        v1.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_VolverMouseClicked

    private void botonNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonNombreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_botonNombreActionPerformed

    private void botonFechaFinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonFechaFinActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_botonFechaFinActionPerformed

    
    // * @param args the command line arguments
  
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Volver;
    private javax.swing.JTextField botonDescr2;
    private javax.swing.JTextField botonFechaFin;
    private javax.swing.JTextField botonFechaIni;
    private javax.swing.JTextField botonId;
    private javax.swing.JTextField botonNombre;
    private javax.swing.JTextArea botonfich;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel labelDesc;
    private javax.swing.JLabel labelFechaFin;
    private javax.swing.JLabel labelFechaIni;
    private javax.swing.JLabel labelId;
    private javax.swing.JLabel labelNombre;
    // End of variables declaration//GEN-END:variables
}
